//
//  SPRequest.h
//  NSTest
//
//  Created by 李双鹏 on 15/10/7.
//  Copyright (c) 2015年 SP. All rights reserved.
//

#import <Foundation/Foundation.h>

#define GET_METHOD  @"GET"
#define POST_METHOD @"POST"

@protocol HttpManagerDelegate;

typedef enum {
    HTTP_LEVEL_HIGH,
    HTTP_LEVEL_NORMAL,
    HTTP_LEVEL_LOW
}HTTP_LEVEL;

typedef enum{
/* ****** 例如：Content-Type:text/html;charset:utf-8; *******/
//    常见的媒体格式类型如下：
    HTTPContentTypeDefault,
///    text/html：HTML格式
    HTTPContentTypeHTML,
///    text/plain：纯文本格式
    HTTPContentTypeTEXT,
///    text/xml：XML格式
    HTTPContentTypeXML_TEXT,
/// image/gif：gif图片格式
    HTTPContentTypeGIF,
/// image/jpeg：jpg图片格式
    HTTPContentTypeJPG,
/// image/png：png图片格式
    HTTPContentTypePNG,

/* ***** 以application开头的媒体格式类型：*******/
    
/// application/xhtml+xml：XHTML格式
    HTTPContentTypeXHTML,
/// application/xml：XML数据格式
    HTTPContentTypeXML,
/// application/atom+xml：AtomXML聚合格式
    HTTPContentTypeAtomXML,
/// application/json：JSON数据格式
    HTTPContentTypeJSON,
/// application/pdf：pdf格式
    HTTPContentTypePDF,
/// application/msword：Word文档格式
    HTTPContentTypeWORD,
/// application/octet-stream：二进制流数据（如常见的文件下载）
    HTTPContentTypeSTREAM,
    
}HTTPContentType;

typedef void (^CallbackBlock) (BOOL success, NSError *error, NSData *data);


@interface SPRequest : NSMutableURLRequest

@property (nonatomic,assign) id<HttpManagerDelegate> delegate;
@property (nonatomic,copy) CallbackBlock callback;
@property (nonatomic,assign) HTTP_LEVEL level;
@property (nonatomic,retain) NSDictionary *userInfo;

//@property (nonatomic, assign) HTTPContentType contentType;// HTTPHeader Content-Type. Default is HTTPContentTypeJSON.
//@property (nonatomic, copy) NSString *charSet;// 请求内容的字符集，默认 UTF-8.

+(instancetype)requestObjectWithUrlString:(NSString *)string;

///设置string类型的 body
//-(void)setHTTPBodyString:(NSString *)string;

@end
